package com.example.mylibrary;

import android.content.Context;
import android.media.Image;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;

public class ImageLoader {
    private ImageLoader() {
    }

    private static ImageLoader loader = new ImageLoader();


    public static ImageLoader getInstance() {
        synchronized (ImageLoader.class) {
            if (loader == null) {
                loader = new ImageLoader();
            }
        }
        return loader;
    }


    public void loadImageUrl(ImageView view, String url) {
        Glide.with(view)
                .load(url)
                .apply(new RequestOptions().placeholder(R.mipmap.image_load_err))
                .into(view);
    }
}
